package com.silvtar.sync.ui;

import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.silvtar.io.StdOut;
import com.silvtar.sync.controller.SilverySyncInit;

public class SyncPanel extends JPanel implements ActionListener {

    SilverySyncInit ssInit;

    /**
     * Create the panel.
     */
    public SyncPanel(SilverySyncInit ssInit) {
        setPreferredSize(new Dimension(300, 300));
        this.ssInit = ssInit;
        setLayout(new BorderLayout(0, 0));
        
        add(StdOut.getTerm(), BorderLayout.CENTER);

        JPanel panel = new JPanel();
        add(panel, BorderLayout.SOUTH);

        JButton button = new JButton("现在同步");
        button.addActionListener(this);
        panel.add(button);

        // --------------------------------------

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        ssInit.startSyncAll();
    }

}
